const router = require('koa-router')()
const Mock = require('mockjs')

router.get('/car', ctx => {
  const { car } = Mock.mock({
    "car|5": [{
      "id": "@id",
      "image": "@image(150x120, @color)",
      "title": "@ctitle",
      "desc": "@cword(10, 20)",
      "price": "@float(10, 1000, 1, 2)",
      "count|1-5": 1,
      state: "@boolean"
    }]
  })
  ctx.body = {
    code: 200,
    data: car
  }
})

module.exports = router
